import Vue from "vue";
import Element from "element-ui";
import App from "@/App";
import i18n from "@/i18n";
import router from "@/router";
import store from "@/store";
import "@/icons";
import "@/element-ui/theme/index.css";
import "@/assets/scss/aui.scss";
import "@/assets/scss/initcss.scss";
import { hasPermission, getDictLabel } from "@/utils";
import cloneDeep from "lodash/cloneDeep";
import resize from "@/directives/size.js";
import VueVirtualScroller from "vue-virtual-scroller";
import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
import VueDragResize from "vue-drag-resize";
import { round } from "@/filters/index";
import config from "../package.json";

import Viewer from "v-viewer";
import "viewerjs/dist/viewer.css";
Vue.use(Viewer);
Viewer.setDefaults({
  Options: {
    inline: true,
    button: true,
    navbar: true,
    title: true,
    toolbar: true,
    tooltip: true,
    movable: true,
    zoomable: true,
    rotatable: true,
    scalable: true,
    transition: true,
    fullscreen: true,
    keyboard: true,
    url: "data-source",
  },
});

import { registerAllModules } from 'handsontable/registry';
import 'handsontable/styles/handsontable.css';
import 'handsontable/styles/ht-theme-main.css';
// register Handsontable's modules
registerAllModules();
import {
  registerCellType,
  NumericCellType,
} from 'handsontable/cellTypes';

import {
  registerPlugin,
  UndoRedo,
} from 'handsontable/plugins';

registerCellType(NumericCellType);
registerPlugin(UndoRedo);

Vue.component("vue-drag-resize", VueDragResize);
console.log("项目的环境变量", process.env);

Vue.config.productionTip = false;

Vue.use(VueVirtualScroller);
Vue.use(Element, {
  size: "default",
  i18n: (key, value) => i18n.t(key, value),
});

// 挂载全局
Vue.prototype.$hasPermission = hasPermission;
Vue.prototype.$getDictLabel = getDictLabel;

Vue.directive("size-ob", resize);
Vue.filter("round", round);

window.xxl = Vue.options;

//保存整站vuex本地储存初始状态
window.SITE_CONFIG["storeState"] = cloneDeep(store.state);
// package的版本号
window.SITE_CONFIG["version"] = config.version;

new Vue({
  i18n,
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
